package cn.data.collection.interceptor;

import cn.data.collection.constant.InitPropertiesConstant;
import cn.data.collection.dto.AreaProcessDTO;
import cn.data.collection.util.LoggerUtils;
import cn.data.collection.util.PropertiesUtils;

public class AutoLimitMainCollectionThread implements Runnable {

	private AreaProcessDTO objAreaProcessDTO;
	private String date;

	public AutoLimitMainCollectionThread(AreaProcessDTO objAreaProcessDTO, String date) {
		super();
		this.objAreaProcessDTO = objAreaProcessDTO;
		this.date = date;
	}

	@Override
	public void run() {
		String collectDate = date.replaceAll("-", "");
		String areaCode = objAreaProcessDTO.getAreaCode();
		
		try {
			int areaThreadNum = Integer.valueOf(PropertiesUtils.getInstance().getINITDATA().get(InitPropertiesConstant.AREA_THREAD_NUM).toString());
			int areaOneThreadInterval = Integer.valueOf(PropertiesUtils.getInstance().getINITDATA().get(InitPropertiesConstant.AREA_ONE_THREAD_INTERVAL).toString());
//			ExecutorService objExecutorService = Executors.newFixedThreadPool(((areaThreadNum*areaOneThreadInterval)+10));
			
			for (int i = 0; i < areaThreadNum; i++) {
//				objExecutorService.execute(new AutoLimitCollectionThread(areaCode,collectDate,(i*areaOneThreadInterval+1),(i+1)*areaOneThreadInterval,objExecutorService));
				LoggerUtils.getInstance().error("日期:"+collectDate+"区号:"+areaCode + "间隔:" + (i*areaOneThreadInterval+1)+"~"+((i+1)*areaOneThreadInterval)+"运行!");
			}
		} catch (Exception e) {
			LoggerUtils.getInstance().error(areaCode + "区号出错:" + e);
		}
	}

}
